#DEFINE SW_HIDE 0
#DEFINE SW_SHOWNORMAL 1
#DEFINE SW_SHOWMINIMIZED 2
#DEFINE SW_SHOWMAXIMIZED 3
#DEFINE SW_SHOWNOACTIVATE 4
#DEFINE SW_SHOW 5
#DEFINE SW_MINIMIZE 6
#DEFINE SW_SHOWMINNOACTIVE 7
#DEFINE SW_SHOWNA 8
#DEFINE SW_RESTORE 9
#DEFINE SW_SHOWDEFAULT 10
 
DECLARE INTEGER WinExec IN kernel32;
    STRING lpCmdLine, INTEGER nCmdShow
 
LOCAL cCmdLine, nResult
*cCmdLine = "D:\Soho\EricHo\TransformTXT\Program\xpdf-2.03-bin\pdftotext.exe -cfg xpdfrc -enc Big5 D:\Soho\EricHo\TransformTXT\Program\xpdf-2.03-bin\jh5.pdf D:\Soho\EricHo\TransformTXT\Program\txt\A1234.txt"
*strtofile(ccmdline,"D:\Soho\EricHo\TransformTXT\Program\pdf.bat")

set default to D:\Work\EricHo\TransformTXT\Program\xpdf-2.03-bin

cCmdLine = [D:\Work\EricHo\TransformTXT\Program\xpdf-2.03-bin\pdf.bat]
 *D:\Soho\EricHo\xpdf-2.03-bin\pdftotext.exe -cfg D:\Soho\EricHo\xpdf-2.03-bin\xpdfrc -enc Big5 D:\Soho\EricHo\xpdf-2.03-bin\jh5.pdf D:\Soho\EricHo\xpdf-2.03-bin\A1234.txt
*cCmdLine = ["D:\Soho\EricHo\xpdf-2.03-bin\pdf.bat"]
*cCmdLine = ["D:\Soho\EricHo\xpdf-2.03-bin\pdftotext.exe -cfg xpdfrc -enc Big5 jh5.pdf A1234.txt"]
*cCmdLine = ["D:\Soho\EricHo\xpdf-2.03-bin\pdftotext.exe" "c:\newfile.txt"]


*!*    cCmdLine = "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE"


 
nResult = WinExec(cCmdLine, SW_SHOWMINIMIZED )
 
IF nResult <= 31
    = MESSAGEBOX("WinExec failed with an error: " +;
        LTRIM(STR(nResult)) + "     ", 48)
ENDIF



*---------------- Run.prg -----------------------------
* Sample program to Execute an MS-DOS command and keep
* the MS-DOS window hidden.
*
*To use this function in FoxPro to create a new directory,
* use the following command:
*
*!*	SET STEP ON 	
*!*	* DO run WITH "D:\Soho\EricHo\xpdf-2.03-bin\pdf.bat"
*!*	*
*!*	DO run WITH "MD f:\temp\TESTDIR"



*!*	FUNCTION run
*!*	PARAMETER doscmd

*!*	DECLARE INTEGER WinExec IN win32api AS run ;
*!*	   STRING command, INTEGER param

*!*	* To have control over the visibility of the
*!*	* MS-DOS command, call it through a .pif file.
*!*	*
*!*	* IMPORTANT: (1) Be sure the "Close Window on Exit" check box in
*!*	* the PIF file is selected. (2) Be sure "Windowed" is the
*!*	* selected "Display Usage."

*!*	cmdstart = SYS(2004) + "FOXRUN.PIF /C "

*!*	* Now concatenate the two pieces of the command:

*!*	fullcmd = cmdstart + doscmd

*!*	retval = run(fullcmd, 0)

*!*	RETURN retval
*!*	*------- End of program ----------------------
